import { RuleItem } from "./rule";
import { CSSProperties } from "vue";
export interface FormOptions {
  //表单显示的元素
  type:
    | "cascader"
    | "checkbox"
    | "checkbox-group"
    | "checkbox-button"
    | "color-picker"
    | "date-picker"
    | "input"
    | "input-number"
    | "radio"
    | "radio-button"
    | "radio-group"
    | "rate"
    | "select"
    | "option"
    | "switch"
    | "slider"
    | "time-picker"
    | "time-select"
    | "transfer"
    | "upload"
    | "editor";
  //表单项的值
  value?: any;
  //表单项label
  label?: string;
  //表单项的标识  没值就不做表单验证
  prop?: string;
  //表单验证规则
  rules?: RuleItem[];
  //表单某些元素特有属性
  attrs?: {
    clearable?: boolean;
    showPassword?: boolean;
    disabled?: boolean;
    //css 样式属性
    style?: CSSProperties;
  };
  placeholder?: string;
  children?: FormOptions[];
  //处理上传组件的属性和方法
  uploadAttrs?: {
    action: string; //上传地址
    headers?: object; //上传请求头
    method?: "post" | "put" | "patch"; //上传请求方法
    multiple?: boolean; //是否支持多选文件
    data?: any; //数据
    name?: string; //上传文件的字段名
    withCredentials?: boolean; //支持发送 cookie 凭证信息
    showFileList?: boolean; //是否显示已上传文件列表
    drag?: boolean; //是否启用拖拽上传
    accept?: string; //接受上传的文件类型
    fileList?: any[]; //上传的文件列表
    listType?: "text" | "picture" | "picture-card"; //上传列表的类型
    autoUpload?: boolean; //是否在选取文件后立即进行上传
    disabled?: boolean; //是否禁用
    limit?: number; //最大允许上传个数
   
  };
  editorattrs?:{
    //编辑器特有属性
    editorConfig?:{[key:string]:any},
    toolbarConfig?:{[key:string]:any},
    editorStyle?:CSSProperties
    toolbarStyle?:CSSProperties
  }
}
